package com.weifangfirecontrolformal.weifangfirecontrolformal.web.web.maintenancesystem.basisinfo;

import cn.hutool.json.JSONObject;
import com.weifangfirecontrolformal.weifangfirecontrolformal.common.base.BaseController;
import com.weifangfirecontrolformal.weifangfirecontrolformal.support.annotaion.Action;
import com.weifangfirecontrolformal.weifangfirecontrolformal.support.annotaion.At;
import com.weifangfirecontrolformal.weifangfirecontrolformal.support.model.RespEntity;
import com.weifangfirecontrolformal.weifangfirecontrolformal.web.service.maintenancesystem.basisinfo.ItemService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.annotation.Resource;

/**
 * @Author: YangYu
 * @ClassName: ItemController
 * @Date: Created in 10:04 2020/12/22
 * @Description: 项目控制器
 */
@Action
@RequestMapping(value = "basisinfo/item")
public class ItemController extends BaseController {

    @Resource
    private ItemService itemService;

    /**
     * @Author YangYu
     * @Description 项目分页列表
     * @Date Created in 10:11 2020/12/22
     * @Param [jsonParam]
     */

    @At(value = "itemPagList", method = RequestMethod.GET, param = {"page", "limit"})
    public RespEntity itemPagList(@RequestBody(required = false) JSONObject jsonParam) {
        return itemService.itemPagList(jsonParam);
    }

    /**
     * @Author YangYu
     * @Description 项目详情
     * @Date Created in 17:32 2020/12/23
     * @Param [jsonParam]
     */

    @At(value = "detail", method = RequestMethod.GET)
    public RespEntity detail(@RequestBody(required = false) JSONObject jsonParam) {
        return itemService.detail(jsonParam);
    }

    /**
     * @Author YangYu
     * @Description 项目新增
     * @Date Created in 17:30 2020/12/23
     * @Param [jsonParam]
     */

    @At(value = "add", method = RequestMethod.POST)
    public RespEntity add(@RequestBody(required = false) JSONObject jsonParam) {
        return itemService.add(jsonParam);
    }

    /**
     * @Author YangYu
     * @Description 项目更新
     * @Date Created in 17:31 2020/12/23
     * @Param [jsonParam]
     */

    @At(value = "update", method = RequestMethod.POST)
    public RespEntity update(@RequestBody(required = false) JSONObject jsonParam) {
        return itemService.update(jsonParam);
    }

    /**
     * @Author YangYu
     * @Description 项目删除
     * @Date Created in 10:34 2020/12/24
     * @Param [jsonParam]
     */

    @At(value = "delete", method = RequestMethod.POST)
    public RespEntity delete(@RequestBody(required = false) JSONObject jsonParam) {
        return itemService.delete(jsonParam);
    }
}
